3.2.36 \(\int (a+a \sin (e+f x))^m \tan ^2(e+f x) \, dx\) [136]

3.2.36.1 Optimal result
3.2.36.2 Mathematica [B] (warning: unable to verify)
3.2.36.3 Rubi [A] (verified)
3.2.36.4 Maple [F]
3.2.36.5 Fricas [F]
3.2.36.6 Sympy [F]
3.2.36.7 Maxima [F]
3.2.36.8 Giac [F]
3.2.36.9 Mupad [F(-1)]

3.2.36.1 Optimal result

Integrand size = 21, antiderivative size = 157 \[ \int (a+a \sin (e+f x))^m \tan ^2(e+f x) \, dx=\frac {\sec (e+f x) (a+a \sin (e+f x))^m}{f (1-m) m}+\frac {2^{-\frac {1}{2}+m} \left (1-m-m^2\right ) \operatorname {Hypergeometric2F1}\left (-\frac {1}{2},\frac {3}{2}-m,\frac {1}{2},\frac {1}{2} (1-\sin (e+f x))\right ) \sec (e+f x) (1+\sin (e+f x))^{\frac {1}{2}-m} (a+a \sin (e+f x))^m}{f (1-m) m}-\frac {\sec (e+f x) (a+a \sin (e+f x))^{1+m}}{a f m} \]

output
sec(f*x+e)*(a+a*sin(f*x+e))^m/f/(1-m)/m+2^(-1/2+m)*(-m^2-m+1)*hypergeom([- 
1/2, 3/2-m],[1/2],1/2-1/2*sin(f*x+e))*sec(f*x+e)*(1+sin(f*x+e))^(1/2-m)*(a 
+a*sin(f*x+e))^m/f/(1-m)/m-sec(f*x+e)*(a+a*sin(f*x+e))^(1+m)/a/f/m
 
3.2.36.2 Mathematica [B] (warning: unable to verify)

Leaf count is larger than twice the leaf count of optimal. \(1756\) vs. \(2(157)=314\).

Time = 22.77 (sec) , antiderivative size = 1756, normalized size of antiderivative = 11.18 \[ \int (a+a \sin (e+f x))^m \tan ^2(e+f x) \, dx =\text {Too large to display} \]

input
Integrate[(a + a*Sin[e + f*x])^m*Tan[e + f*x]^2,x]
 
output
(Sqrt[Sec[e + f*x]^2]*(a + a*Sin[e + f*x])^m*Tan[e + f*x]^2*(a + (a*Tan[e 
+ f*x])/Sqrt[Sec[e + f*x]^2])^m*(1 + (Sqrt[Sec[e + f*x]^2] + Tan[e + f*x]) 
^2)^m*((1 + 2*m)*Hypergeometric2F1[-1 + m, -1/2 + m, 1/2 + m, -(Sqrt[Sec[e 
 + f*x]^2] + Tan[e + f*x])^2] - 4*(-1 + 2*m)*Hypergeometric2F1[1/2 + m, 1 
+ m, 3/2 + m, -(Sqrt[Sec[e + f*x]^2] + Tan[e + f*x])^2]*(1 + 2*Sqrt[Sec[e 
+ f*x]^2]*Tan[e + f*x] + 2*Tan[e + f*x]^2)))/(2*f*(-1 + 2*m)*(1 + 2*m)*(Se 
c[e + f*x]^2 + Sqrt[Sec[e + f*x]^2]*Tan[e + f*x])*((m*Sqrt[Sec[e + f*x]^2] 
*(Sqrt[Sec[e + f*x]^2] + Tan[e + f*x])*(a + (a*Tan[e + f*x])/Sqrt[Sec[e + 
f*x]^2])^m*(1 + (Sqrt[Sec[e + f*x]^2] + Tan[e + f*x])^2)^(-1 + m)*((1 + 2* 
m)*Hypergeometric2F1[-1 + m, -1/2 + m, 1/2 + m, -(Sqrt[Sec[e + f*x]^2] + T 
an[e + f*x])^2] - 4*(-1 + 2*m)*Hypergeometric2F1[1/2 + m, 1 + m, 3/2 + m, 
-(Sqrt[Sec[e + f*x]^2] + Tan[e + f*x])^2]*(1 + 2*Sqrt[Sec[e + f*x]^2]*Tan[ 
e + f*x] + 2*Tan[e + f*x]^2)))/((-1 + 2*m)*(1 + 2*m)) + (Sqrt[Sec[e + f*x] 
^2]*Tan[e + f*x]*(a + (a*Tan[e + f*x])/Sqrt[Sec[e + f*x]^2])^m*(1 + (Sqrt[ 
Sec[e + f*x]^2] + Tan[e + f*x])^2)^m*((1 + 2*m)*Hypergeometric2F1[-1 + m, 
-1/2 + m, 1/2 + m, -(Sqrt[Sec[e + f*x]^2] + Tan[e + f*x])^2] - 4*(-1 + 2*m 
)*Hypergeometric2F1[1/2 + m, 1 + m, 3/2 + m, -(Sqrt[Sec[e + f*x]^2] + Tan[ 
e + f*x])^2]*(1 + 2*Sqrt[Sec[e + f*x]^2]*Tan[e + f*x] + 2*Tan[e + f*x]^2)) 
)/(2*(-1 + 2*m)*(1 + 2*m)*(Sec[e + f*x]^2 + Sqrt[Sec[e + f*x]^2]*Tan[e + f 
*x])) + (m*Sqrt[Sec[e + f*x]^2]*(a + (a*Tan[e + f*x])/Sqrt[Sec[e + f*x]...
 
3.2.36.3 Rubi [A] (verified)

Time = 0.56 (sec) , antiderivative size = 161, normalized size of antiderivative = 1.03, number of steps used = 9, number of rules used = 8, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.381, Rules used = {3042, 3192, 3042, 3339, 3042, 3168, 80, 79}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int \tan ^2(e+f x) (a \sin (e+f x)+a)^m \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \tan (e+f x)^2 (a \sin (e+f x)+a)^mdx\)

\(\Big \downarrow \) 3192

\(\displaystyle \frac {\int \sec ^2(e+f x) (\sin (e+f x) a+a)^m (a (m+1)+a \sin (e+f x))dx}{a m}-\frac {\sec (e+f x) (a \sin (e+f x)+a)^{m+1}}{a f m}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {\int \frac {(\sin (e+f x) a+a)^m (a (m+1)+a \sin (e+f x))}{\cos (e+f x)^2}dx}{a m}-\frac {\sec (e+f x) (a \sin (e+f x)+a)^{m+1}}{a f m}\)

\(\Big \downarrow \) 3339

\(\displaystyle \frac {\frac {a \left (-m^2-m+1\right ) \int \sec ^2(e+f x) (\sin (e+f x) a+a)^mdx}{1-m}+\frac {a \sec (e+f x) (a \sin (e+f x)+a)^m}{f (1-m)}}{a m}-\frac {\sec (e+f x) (a \sin (e+f x)+a)^{m+1}}{a f m}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {\frac {a \left (-m^2-m+1\right ) \int \frac {(\sin (e+f x) a+a)^m}{\cos (e+f x)^2}dx}{1-m}+\frac {a \sec (e+f x) (a \sin (e+f x)+a)^m}{f (1-m)}}{a m}-\frac {\sec (e+f x) (a \sin (e+f x)+a)^{m+1}}{a f m}\)

\(\Big \downarrow \) 3168

\(\displaystyle \frac {\frac {a^3 \left (-m^2-m+1\right ) \sec (e+f x) \sqrt {a-a \sin (e+f x)} \sqrt {a \sin (e+f x)+a} \int \frac {(\sin (e+f x) a+a)^{m-\frac {3}{2}}}{(a-a \sin (e+f x))^{3/2}}d\sin (e+f x)}{f (1-m)}+\frac {a \sec (e+f x) (a \sin (e+f x)+a)^m}{f (1-m)}}{a m}-\frac {\sec (e+f x) (a \sin (e+f x)+a)^{m+1}}{a f m}\)

\(\Big \downarrow \) 80

\(\displaystyle \frac {\frac {a^2 2^{m-\frac {3}{2}} \left (-m^2-m+1\right ) \sec (e+f x) \sqrt {a-a \sin (e+f x)} (\sin (e+f x)+1)^{\frac {1}{2}-m} (a \sin (e+f x)+a)^m \int \frac {\left (\frac {1}{2} \sin (e+f x)+\frac {1}{2}\right )^{m-\frac {3}{2}}}{(a-a \sin (e+f x))^{3/2}}d\sin (e+f x)}{f (1-m)}+\frac {a \sec (e+f x) (a \sin (e+f x)+a)^m}{f (1-m)}}{a m}-\frac {\sec (e+f x) (a \sin (e+f x)+a)^{m+1}}{a f m}\)

\(\Big \downarrow \) 79

\(\displaystyle \frac {\frac {a 2^{m-\frac {1}{2}} \left (-m^2-m+1\right ) \sec (e+f x) (\sin (e+f x)+1)^{\frac {1}{2}-m} (a \sin (e+f x)+a)^m \operatorname {Hypergeometric2F1}\left (-\frac {1}{2},\frac {3}{2}-m,\frac {1}{2},\frac {1}{2} (1-\sin (e+f x))\right )}{f (1-m)}+\frac {a \sec (e+f x) (a \sin (e+f x)+a)^m}{f (1-m)}}{a m}-\frac {\sec (e+f x) (a \sin (e+f x)+a)^{m+1}}{a f m}\)

input
Int[(a + a*Sin[e + f*x])^m*Tan[e + f*x]^2,x]
 
output
-((Sec[e + f*x]*(a + a*Sin[e + f*x])^(1 + m))/(a*f*m)) + ((a*Sec[e + f*x]* 
(a + a*Sin[e + f*x])^m)/(f*(1 - m)) + (2^(-1/2 + m)*a*(1 - m - m^2)*Hyperg 
eometric2F1[-1/2, 3/2 - m, 1/2, (1 - Sin[e + f*x])/2]*Sec[e + f*x]*(1 + Si 
n[e + f*x])^(1/2 - m)*(a + a*Sin[e + f*x])^m)/(f*(1 - m)))/(a*m)
 

3.2.36.3.1 Defintions of rubi rules used

rule 79
Int[((a_) + (b_.)*(x_))^(m_)*((c_) + (d_.)*(x_))^(n_), x_Symbol] :> Simp[(( 
a + b*x)^(m + 1)/(b*(m + 1)*(b/(b*c - a*d))^n))*Hypergeometric2F1[-n, m + 1 
, m + 2, (-d)*((a + b*x)/(b*c - a*d))], x] /; FreeQ[{a, b, c, d, m, n}, x] 
&&  !IntegerQ[m] &&  !IntegerQ[n] && GtQ[b/(b*c - a*d), 0] && (RationalQ[m] 
 ||  !(RationalQ[n] && GtQ[-d/(b*c - a*d), 0]))
 

rule 80
Int[((a_) + (b_.)*(x_))^(m_)*((c_) + (d_.)*(x_))^(n_), x_Symbol] :> Simp[(c 
 + d*x)^FracPart[n]/((b/(b*c - a*d))^IntPart[n]*(b*((c + d*x)/(b*c - a*d))) 
^FracPart[n])   Int[(a + b*x)^m*Simp[b*(c/(b*c - a*d)) + b*d*(x/(b*c - a*d) 
), x]^n, x], x] /; FreeQ[{a, b, c, d, m, n}, x] &&  !IntegerQ[m] &&  !Integ 
erQ[n] && (RationalQ[m] ||  !SimplerQ[n + 1, m + 1])
 

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 3168
Int[(cos[(e_.) + (f_.)*(x_)]*(g_.))^(p_)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x 
_)])^(m_.), x_Symbol] :> Simp[a^2*((g*Cos[e + f*x])^(p + 1)/(f*g*(a + b*Sin 
[e + f*x])^((p + 1)/2)*(a - b*Sin[e + f*x])^((p + 1)/2)))   Subst[Int[(a + 
b*x)^(m + (p - 1)/2)*(a - b*x)^((p - 1)/2), x], x, Sin[e + f*x]], x] /; Fre 
eQ[{a, b, e, f, g, m, p}, x] && EqQ[a^2 - b^2, 0] &&  !IntegerQ[m]
 

rule 3192
Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_)*tan[(e_.) + (f_.)*(x_)]^2, 
x_Symbol] :> Simp[-(a + b*Sin[e + f*x])^(m + 1)/(b*f*m*Cos[e + f*x]), x] + 
Simp[1/(b*m)   Int[(a + b*Sin[e + f*x])^m*((b*(m + 1) + a*Sin[e + f*x])/Cos 
[e + f*x]^2), x], x] /; FreeQ[{a, b, e, f, m}, x] && EqQ[a^2 - b^2, 0] && 
!IntegerQ[m] &&  !LtQ[m, 0]
 

rule 3339
Int[(cos[(e_.) + (f_.)*(x_)]*(g_.))^(p_)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x 
_)])^(m_.)*((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(-d)* 
(g*Cos[e + f*x])^(p + 1)*((a + b*Sin[e + f*x])^m/(f*g*(m + p + 1))), x] + S 
imp[(a*d*m + b*c*(m + p + 1))/(b*(m + p + 1))   Int[(g*Cos[e + f*x])^p*(a + 
 b*Sin[e + f*x])^m, x], x] /; FreeQ[{a, b, c, d, e, f, g, m, p}, x] && EqQ[ 
a^2 - b^2, 0] && NeQ[m + p + 1, 0]
 
3.2.36.4 Maple [F]

\[\int \left (a +a \sin \left (f x +e \right )\right )^{m} \left (\tan ^{2}\left (f x +e \right )\right )d x\]

input
int((a+a*sin(f*x+e))^m*tan(f*x+e)^2,x)
 
output
int((a+a*sin(f*x+e))^m*tan(f*x+e)^2,x)
 
3.2.36.5 Fricas [F]

\[ \int (a+a \sin (e+f x))^m \tan ^2(e+f x) \, dx=\int { {\left (a \sin \left (f x + e\right ) + a\right )}^{m} \tan \left (f x + e\right )^{2} \,d x } \]

input
integrate((a+a*sin(f*x+e))^m*tan(f*x+e)^2,x, algorithm="fricas")
 
output
integral((a*sin(f*x + e) + a)^m*tan(f*x + e)^2, x)
 
3.2.36.6 Sympy [F]

\[ \int (a+a \sin (e+f x))^m \tan ^2(e+f x) \, dx=\int \left (a \left (\sin {\left (e + f x \right )} + 1\right )\right )^{m} \tan ^{2}{\left (e + f x \right )}\, dx \]

input
integrate((a+a*sin(f*x+e))**m*tan(f*x+e)**2,x)
 
output
Integral((a*(sin(e + f*x) + 1))**m*tan(e + f*x)**2, x)
 
3.2.36.7 Maxima [F]

\[ \int (a+a \sin (e+f x))^m \tan ^2(e+f x) \, dx=\int { {\left (a \sin \left (f x + e\right ) + a\right )}^{m} \tan \left (f x + e\right )^{2} \,d x } \]

input
integrate((a+a*sin(f*x+e))^m*tan(f*x+e)^2,x, algorithm="maxima")
 
output
integrate((a*sin(f*x + e) + a)^m*tan(f*x + e)^2, x)
 
3.2.36.8 Giac [F]

\[ \int (a+a \sin (e+f x))^m \tan ^2(e+f x) \, dx=\int { {\left (a \sin \left (f x + e\right ) + a\right )}^{m} \tan \left (f x + e\right )^{2} \,d x } \]

input
integrate((a+a*sin(f*x+e))^m*tan(f*x+e)^2,x, algorithm="giac")
 
output
integrate((a*sin(f*x + e) + a)^m*tan(f*x + e)^2, x)
 
3.2.36.9 Mupad [F(-1)]

Timed out. \[ \int (a+a \sin (e+f x))^m \tan ^2(e+f x) \, dx=\int {\mathrm {tan}\left (e+f\,x\right )}^2\,{\left (a+a\,\sin \left (e+f\,x\right )\right )}^m \,d x \]

input
int(tan(e + f*x)^2*(a + a*sin(e + f*x))^m,x)
 
output
int(tan(e + f*x)^2*(a + a*sin(e + f*x))^m, x)